// 请求
import 'reflect-metadata'

function methodDecorator(method: string) { // 柯里化
  return function (path: string) {
    return function (target: any, key: string, descriptor: PropertyDecorator) {
      Reflect.defineMetadata('method', method, descriptor.value)
      
    }
  }
}

const Get = methodDecorator('get')

@AbortController('/article')
class ArticleController {
  @Get('/detail')
  getDetail() {
    return {
      err: 0,
      data: 'get Detail'
    }
  }
  @Post('/add')
  addArticle() {
    return {
      err: 0,
      data: 'post add'
    }
  }
}

// nestjs的写法
// get /article/detail -> { err: 0, data: 'get Detail' }
// post /article/add -> { err: 0, data: 'post Add' }

const articleController = new ArticleController()

const routes = createRoutes(articleController)

export {}